<?php
require_once(MODEL_PATH.DS.'User.php');
$User = new User();

if(check_post()){
	if(strtolower($_POST['verifycode'])==strtolower($_SESSION['capt_code'])){
		$result = $User->login($_POST);
		if($result){
			$_SESSION['user_id'] = $result['customer_id'];
			$_SESSION['name'] = $result['name'];
			$_SESSION['email'] = $result['customer_id'];
			$_SESSION['is_login'] = TRUE;
			$result = $User->updateLoginStatics($result['customer_id'],date('Y-m-d H:i:s'));
			redirect('index.php?mod=home&act=index');
		}else{
			redirect('index.php','用户名或密码错误!');
		}
	}else{
		redirect('index.php','请输入验证码!');
	}
}

include load_tpl('user_login');

?>